package com.huixin.powermonitor.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huixin.powermonitor.common.Result;
import com.huixin.powermonitor.entity.Reports;
import com.huixin.powermonitor.service.ReportsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author huixin
 * @since 2025-07-08
 */
@RestController
@RequestMapping("/reports")
public class ReportsController {
    @Autowired
    private ReportsService reportsService;

    @GetMapping("/show_rep")
    public Result show_rep(){
        List<Reports> reportsList = reportsService.list();
        return Result.suc(reportsList);
    }
    @PostMapping("/addreport")
    public Result addreport(@RequestBody Reports reports){
        reportsService.save(reports);
        return Result.suc("添加成功");
    }

    @GetMapping("/get_rep/{id}")
    public Result get_rep(@PathVariable("id") Integer  id) {
        return Result.suc(reportsService.getById(id));
    }
}
